<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>html辅助方法 | haijd</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="Asp.Net MVC" />
  
  
  
  
  <meta name="description" content="HTML辅助方法">
<meta name="keywords" content="Asp.Net MVC">
<meta property="og:type" content="article">
<meta property="og:title" content="HTML辅助方法">
<meta property="og:url" content="http://www.hais2.com/2015/08/02/HTML-helper-methods/index.html">
<meta property="og:site_name" content="haijd">
<meta property="og:description" content="HTML辅助方法">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2017-08-02T15:22:33.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="HTML辅助方法">
<meta name="twitter:description" content="HTML辅助方法">
  
    <link rel="alternate" href="/atom.xml" title="haijd" type="application/atom+xml">
  
  <link rel="icon" href="/css/images/favicon.ico">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/9749f0/00000000000000000001008f/27/l?subset_id=2&fvd=n5) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/90cf9f/000000000000000000010091/27/l?subset_id=2&fvd=n7) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/8a5494/000000000000000000013365/27/l?subset_id=2&fvd=n4) format("woff2");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/d337d8/000000000000000000010095/27/l?subset_id=2&fvd=i4) format("woff2");font-weight:400;font-style:italic;}</style>
    
  <link rel="stylesheet" id="athemes-headings-fonts-css" href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz%3A200%2C300%2C400%2C700&amp;ver=4.6.1" type="text/css" media="all">
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/jquery-3.1.1.min.js"></script>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/css/bootstrap.css" >
  <link rel="stylesheet" href="/css/hiero.css" >
  <link rel="stylesheet" href="/css/glyphs.css" >
  
    <link rel="stylesheet" href="/css/vdonate.css" >
  

</head>

<script>
var themeMenus = {};

  themeMenus["/"] = "Home"; 

  themeMenus["/archives"] = "Archives"; 

  themeMenus["/categories"] = "Categories"; 

  themeMenus["/tags"] = "Tags"; 

  themeMenus["/about"] = "About"; 

</script>


  <body data-spy="scroll" data-target="#toc" data-offset="50">


  <header id="allheader" class="site-header" role="banner">
  <div class="clearfix container">
      <div class="site-branding">

          <h1 class="site-title">
            
              <a href="/" title="haijd" rel="home"> haijd </a>
            
          </h1>

          
            <div class="site-description">Stay Hungry,Stay Foolish</div>
          
            
          <nav id="main-navigation" class="main-navigation" role="navigation">
            <a class="nav-open">Menu</a>
            <a class="nav-close">Close</a>
            <div class="clearfix sf-menu">

              <ul id="main-nav" class="nmenu sf-js-enabled">
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/">Home</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/archives">Archives</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/categories">Categories</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/tags">Tags</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/about">About</a> </li>
                    
              </ul>
            </div>
          </nav>


      </div>
  </div>
</header>




  <div id="container">
    <div id="wrap">
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-HTML-helper-methods" style="width: 66%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
  <div id="articleInner" class="clearfix post-1016 post type-post status-publish format-standard has-post-thumbnail hentry category-template-2 category-uncategorized tag-codex tag-edge-case tag-featured-image tag-image tag-template">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      HTML辅助方法
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	Posted on <a href="/2015/08/02/HTML-helper-methods/" class="article-date">
	  <time datetime="2015-08-02T15:15:02.000Z" itemprop="datePublished">August 2, 2015</time>
	</a>

      
	<span id="busuanzi_container_page_pv">
	  本文总阅读量<span id="busuanzi_value_page_pv"></span>次
	</span>

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <p>　　HTML辅助方法，也就是<code>HtmlHelper</code>，就是帮助快捷的产生HTML标签的作用。<br>　　HTML辅助方法可以编写超链接、表单(<form>)、输入框、选项、加载其他的分布视图(Partial View)等。</form></p>
<h3 id="超链接：Html-ActionLink"><a href="#超链接：Html-ActionLink" class="headerlink" title="超链接：Html.ActionLink"></a>超链接：Html.ActionLink</h3><p>　　<a href="mailto:`@Html.ActionLink" target="_blank" rel="noopener">`@Html.ActionLink</a>()<code>用于产生超链接。并且链接的文字部分会自动的进行HTML编码(HtmlEncode)。
&lt;!--more--&gt;
**Html.ActionLink()方法重载**:</code>@Html.ActionLink(“链接文字”,”Action_Name”)<code>：该语法生成的超链接，点击后会跳转到“Action_Name(控制器方法)”所指向的Action。由于这里并没有指定“Controller”的名字，所以会指向默认(该页面所属)的控制器。</code>@Html.ActionLink(“链接文字”,”Action_Name”,”Controller_Name”)<code>：如要将链接指向其他控制器(不是当前页面所属)时，应该在第三参数中注明控制器的名称。</code>@Html.ActionLink(“链接文字”,”Action_Name”,new {id = 12,page = 5})<code>：当链接需要额外的路由参数时，可以传入匿名类型的数据。比如这里会生成这样的标签：</code><a href="/Controller_Name/Action_Name?id=12&page=5">链接文字</a><code></code>@Html.ActionLink(“链接文字”,”Action_Name”,null,new {@class = “btnLink”})`：当要在生成的HTML标签中加入额外的HTML属性时，可以在第四个参数中加入。比如设置HTML的class属性。但是由于class是c#中的关键字，所以在 这里使用时需要在前面加上@符号；而且当需要输出带有“-”数属性时(HTML5的属性)，比如“data-value”，需要将“-”换成“_”。</p>
<p>　　<strong>使用Html.ActionLink()时，第一个参数不能输入空字符串或者null值，否则就会抛出异常。</strong></p>
<h3 id="表单提交：Html-BeginForm"><a href="#表单提交：Html-BeginForm" class="headerlink" title="表单提交：Html.BeginForm"></a>表单提交：Html.BeginForm</h3><p>　　<a href="mailto:`@Html.BeginForm" target="_blank" rel="noopener">`@Html.BeginForm</a>()`可以生成表单提交标签。表单的提交方式默认为Post，可以使用参数将提交方式修改为GET。<br>　　<br>Html.BeginForm()的两种使用方法：</p>
<ol>
<li><p>使用<code>@using{}</code>包裹住Html.BeginForm()以及表单中的标签成员</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">@<span class="keyword">using</span>(<span class="keyword">Html</span>.<span class="keyword">BeginForm</span>())</span><br><span class="line">&#123;</span><br><span class="line">    &lt;<span class="selector-tag">p</span>&gt;账号：@<span class="keyword">html</span>.<span class="keyword">TextBox</span>("<span class="keyword">Account</span>")&lt;/<span class="keyword">p</span>&gt;</span><br><span class="line">    &lt;p&gt;密码：@Html.PassWord(<span class="string">"PassWord"</span>)&lt;/p&gt;</span><br><span class="line">    &lt;input type=<span class="string">"submit"</span> value=<span class="string">"注册"</span> /&gt;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>在开头和结尾分别使用<code>Html.BeginForm()</code>、<code>Html.EndForm()</code></p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">@&#123;<span class="selector-tag">Html</span><span class="selector-class">.BeginForm</span>("<span class="selector-tag">About</span>","<span class="selector-tag">Home</span>");&#125;</span><br><span class="line">    @<span class="keyword">Html</span>.<span class="keyword">TextArea</span>("<span class="keyword">Date</span>")</span><br><span class="line">    @Html.TextArea(<span class="string">"123"</span>)</span><br><span class="line">    &lt;input type=<span class="string">"submit"</span> /&gt;</span><br><span class="line">@&#123;<span class="selector-tag">Html</span><span class="selector-class">.EndForm</span>();&#125;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>　　<strong>推荐使用using的方式编写Html.BeginForm(),因为代码比较可看。</strong></p>
<h4 id="使用GET方式提交表单"><a href="#使用GET方式提交表单" class="headerlink" title="使用GET方式提交表单"></a>使用GET方式提交表单</h4><p>　　如果要使用GET方式提交表单，可以输入第三个参数<code>FormMethod.Get</code>：<br><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">@<span class="keyword">using</span>(<span class="keyword">Html</span>.<span class="keyword">BeginForm</span>("<span class="keyword">Search</span>","<span class="keyword">Home</span>",<span class="keyword">FormMethod</span>.<span class="keyword">Get</span>))</span><br><span class="line">&#123;</span><br><span class="line">    @<span class="keyword">Html</span>.<span class="keyword">TextArea</span>("<span class="keyword">2333</span>")</span><br><span class="line">    &lt;input type=<span class="string">"submit"</span> /&gt;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<h4 id="使用上传-提交-文件功能"><a href="#使用上传-提交-文件功能" class="headerlink" title="使用上传(提交)文件功能"></a>使用上传(提交)文件功能</h4><p>　　想要实现上传文件的功能，需要在<code>&lt;form&gt;</code>表单中增加一个<code>enctype</code>属性，所以在Html.BeginForm()中需要添加第四个参数：<br>　　因为Html辅助方法中没有File方法，所以需要借助TextBox方法来代替，然后给TextBox传入第三个参数将type属性修改为file。<br><figure class="highlight scala"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@using</span>(<span class="type">Html</span>.<span class="type">BeginForm</span>(<span class="string">"Upload"</span>,<span class="string">"File"</span>,<span class="type">FormMethod</span>.<span class="type">Post</span>,<span class="keyword">new</span> &#123;enctype = <span class="string">"multipart/from-data"</span>&#125;))</span><br><span class="line">&#123;</span><br><span class="line">    <span class="meta">@Html</span>.<span class="type">TextBox</span>(<span class="string">"FileName"</span>,<span class="string">""</span>,<span class="keyword">new</span> &#123;<span class="class"><span class="keyword">type</span></span>=<span class="string">"file"</span>,size=<span class="string">"10"</span>&#125;)</span><br><span class="line">    &lt;input <span class="class"><span class="keyword">type</span></span>=<span class="string">"submit"</span> /&gt;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&lt;!--输出的<span class="type">HTML</span>代码为：--&gt;</span><br><span class="line">&lt;form action=<span class="string">"/File/Upload"</span> enctype=<span class="string">"multipart/from-data"</span> method=<span class="string">"post"</span>&gt;</span><br><span class="line">    &lt;input id=<span class="string">"FileName"</span> name=<span class="string">"FileName"</span> size=<span class="string">"10"</span> <span class="class"><span class="keyword">type</span></span>=<span class="string">"file"</span> value=<span class="string">""</span> /&gt;</span><br><span class="line">    &lt;input <span class="class"><span class="keyword">type</span></span>=<span class="string">"submit"</span> /&gt;</span><br><span class="line">&lt;/form&gt;</span><br></pre></td></tr></table></figure></p>
<h4 id="常用的表单输入辅助方法"><a href="#常用的表单输入辅助方法" class="headerlink" title="常用的表单输入辅助方法"></a>常用的表单输入辅助方法</h4><p>　　● <code>Html.BeginForm()</code>：输出<code>&lt;form&gt;</code>标签<br>　　● <code>Html.EndForm()</code>：输出<code>&lt;/form&gt;</code>标签<br>　　● <code>Html.Lable()</code>：输出<code>&lt;lable&gt;</code>标签<br>　　● <code>Html.TextBox()</code>：输出<code>&lt;input type=&quot;text&quot; /&gt;</code>标签<br>　　● <code>Html.TextArea()</code>：输出<code>&lt;textarea&gt;</code>标签，可以指定rows和column的值。<br>　　● <code>Html.PassWord()</code>：输出<code>&lt;input type=&quot;password&quot; /&gt;</code>标签<br>　　● <code>Html.Checkbox()</code>：输出<code>&lt;input type=&quot;checkbox&quot; /&gt;</code>标签<br>　　● <code>Html.RadioButton()</code>：输出<code>&lt;input type=&quot;radio&quot; /&gt;</code>标签，可以指定是否要默认选取预设值<a href="mailto:`@Html.ReadioButton" target="_blank" rel="noopener">`@Html.ReadioButton</a>(“name”,”vlaue”,true)<code>。
　　●</code>Html.DropDownList()<code>：输出</code><select><code>标签
　　●</code>Html.ListBox()<code>：输出</code></select><select mulitiple=""><code>标签
　　●</code>Html.Hidden()<code>：输出</code></select><input type="hidden"><code>标签
　　●</code>Html.ValidationSummary()`：输出表单验证失败是的错误信息摘要</p>
<p>　　这些标签大多都有重载，比如<a href="mailto:`@Html.TextBox" target="_blank" rel="noopener">`@Html.TextBox</a>()`重载：<br><figure class="highlight dust"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="xml">@Html.TextBox("UserName","Is2",new</span><span class="template-variable">&#123;id="textId"&#125;</span><span class="xml">)</span></span><br><span class="line"><span class="xml"><span class="comment">&lt;!--输出下面的HTML代码：--&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">input</span> <span class="attr">id</span>=<span class="string">"textId"</span> <span class="attr">name</span>=<span class="string">"UserName"</span> <span class="attr">type</span>=<span class="string">"text"</span> <span class="attr">value</span>=<span class="string">"Is2"</span> /&gt;</span></span></span><br></pre></td></tr></table></figure></p>
<h3 id="强类型的辅助方法"><a href="#强类型的辅助方法" class="headerlink" title="强类型的辅助方法"></a>强类型的辅助方法</h3><p>　　强类型的辅助方法也就是可以在辅助方法中使用@model加载需要的内容，而且可以使用简洁的lambda表达式。<br>　　强类型的辅助方法名称基本上就是“原本的名字后面加上For”，比如<a href="mailto:`@Html.TextBox" target="_blank" rel="noopener">`@Html.TextBox</a>()<code>的强类型形式就是</code>@Html.TextBoxFor()<code>。
　　要使用强类型的辅助方法，需要在View最开始注明强类型模式:</code>@model MvcApplicationTest.Product`。</p>
<h4 id="使用强类型辅助方法的例子"><a href="#使用强类型辅助方法的例子" class="headerlink" title="使用强类型辅助方法的例子"></a>使用强类型辅助方法的例子</h4><p><strong>数据模型：</strong><br><figure class="highlight cs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">using</span> System.ComponentModel;</span><br><span class="line"><span class="keyword">using</span> System.ComponentModel.DataAnnotations;</span><br><span class="line"></span><br><span class="line"><span class="keyword">namespace</span> <span class="title">MvcApplicationTest</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">class</span> <span class="title">Product</span></span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">public</span> <span class="keyword">int</span> Id&#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">        [<span class="meta">Required</span>]</span><br><span class="line">        [<span class="meta">DisplayName(<span class="meta-string">"产品名称"</span>)</span>]</span><br><span class="line">        <span class="keyword">public</span> <span class="keyword">string</span> Name&#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">        [<span class="meta">Required</span>]</span><br><span class="line">        [<span class="meta">DisplayName(<span class="meta-string">"产品说明"</span>)</span>]</span><br><span class="line">        <span class="keyword">public</span> <span class="keyword">string</span> Description&#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">        [<span class="meta">Required</span>]</span><br><span class="line">        <span class="keyword">public</span> <span class="keyword">int</span> UnitPrice&#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p><strong>View：</strong><br><figure class="highlight less"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">@model</span> MvcApplicationTest.Product</span><br><span class="line"></span><br><span class="line"><span class="variable">@using</span>(Html.BeginForm())</span><br><span class="line">&#123;</span><br><span class="line">    <span class="variable">@Html</span>.ValidationSummary(true)</span><br><span class="line">    </span><br><span class="line">    &lt;fieldset&gt;</span><br><span class="line">        &lt;h2&gt;产品信息&lt;/h2&gt;</span><br><span class="line">        &lt;div&gt;</span><br><span class="line">            <span class="variable">@Html</span>.LableFor(model=&gt;model.Name)</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">        &lt;div&gt;</span><br><span class="line">            <span class="variable">@Html</span>.LableFor(model=&gt;model.Description)</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line">        &lt;input type=<span class="string">"submit"</span> /&gt;</span><br><span class="line">    &lt;/fieldset&gt;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<h3 id="使用辅助方法加载分布视图"><a href="#使用辅助方法加载分布视图" class="headerlink" title="使用辅助方法加载分布视图"></a>使用辅助方法加载分布视图</h3><p>　　使用<a href="mailto:`@Html.Partial" target="_blank" rel="noopener">`@Html.Partial</a>()`方法可以在View中加载一个分布视图(Partial View)。<br>　　因为分布视图是片段式的，所以需要在一个完整页面中加载分布视图。如果分布视图中需要参数，也可以在方法中传入。</p>
<p><strong>index.cshtml</strong><br><figure class="highlight less"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">@model</span> MvcApplicationTest.Product</span><br><span class="line"></span><br><span class="line"><span class="variable">@Html</span>.Partial(<span class="string">"ProductInfo"</span>,(object)model.Name)</span><br></pre></td></tr></table></figure></p>
<p><strong>Partial View(ProductInfo)</strong><br><figure class="highlight less"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable">@model</span> System.String</span><br><span class="line"></span><br><span class="line"><span class="variable">@Html</span>.TextBox(model)</span><br></pre></td></tr></table></figure></p>

      
    </div>
    <footer class="entry-meta entry-footer">
      
	<span class="ico-folder"></span>
    <a class="article-category-link" href="/categories/Asp-Net-MVC/">Asp.Net MVC</a>

      
  <span class="ico-tags"></span>
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Asp-Net-MVC/">Asp.Net MVC</a></li></ul>

      
        <div id="donation_div"></div>

<script src="/js/vdonate.js"></script>
<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: '/css/images/wechatPay.png',
  alipayImage: '/css/images/alipay.jpg'
});
</script>
      

      
        
	<section id="comments" class="comment">
	  <div id="disqus_thread">
	  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
	  </div>
	</section>

	<script type="text/javascript">
	var disqus_shortname = 'haijdblog';
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/count.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	</script>


      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2015/09/19/Extends-MVC-MVP-and-MVVM/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          MVC延伸：MVP、MVVM
        
      </div>
    </a>
  
  
    <a href="/2015/07/18/Write-the-template-directive-met-problems/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">directive中写template遇见的问题</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
      <ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#超链接：Html-ActionLink"><span class="nav-number">1.</span> <span class="nav-text">超链接：Html.ActionLink</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#表单提交：Html-BeginForm"><span class="nav-number">2.</span> <span class="nav-text">表单提交：Html.BeginForm</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#使用GET方式提交表单"><span class="nav-number">2.1.</span> <span class="nav-text">使用GET方式提交表单</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#使用上传-提交-文件功能"><span class="nav-number">2.2.</span> <span class="nav-text">使用上传(提交)文件功能</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#常用的表单输入辅助方法"><span class="nav-number">2.3.</span> <span class="nav-text">常用的表单输入辅助方法</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#强类型的辅助方法"><span class="nav-number">3.</span> <span class="nav-text">强类型的辅助方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#使用强类型辅助方法的例子"><span class="nav-number">3.1.</span> <span class="nav-text">使用强类型辅助方法的例子</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#使用辅助方法加载分布视图"><span class="nav-number">4.</span> <span class="nav-text">使用辅助方法加载分布视图</span></a></li></ol>
    
    </div>
  </aside>
</section>
        
      </div>
      <footer id="footer" class="site-footer">
  

  <div class="clearfix container">
      <div class="site-info">
	      &copy; 2018 haijd All Rights Reserved.
          
            <span id="busuanzi_container_site_uv">
              本站访客数<span id="busuanzi_value_site_uv"></span>人次  
              本站总访问量<span id="busuanzi_value_site_pv"></span>次
            </span>
          
      </div>
      <div class="site-credit">
        Theme by <a href="https://github.com/iTimeTraveler/hexo-theme-hiero" target="_blank">hiero</a>
      </div>
  </div>
</footer>


<!-- min height -->

<script>
    var contentdiv = document.getElementById("content");

    contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("allheader").offsetHeight - document.getElementById("footer").offsetHeight + "px";
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/categories" class="mobile-nav-link">Categories</a>
  
    <a href="/tags" class="mobile-nav-link">Tags</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/scripts.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/main.js"></script>








	<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/js/totop.js" async=""></script>
</body>
</html>
